//
//  MainMenuViewController.m
//  Sms_qxt
//
//  Created by mac on 11-11-14.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "MainMenuViewController.h"
#import "sys_ericAppDelegate.h"
#import "MsmViewController.h"
#import "NumberContentViewController.h"
#import "AccountInformationViewController.h"
#import "NoticeInformationViewController.h"
#import "FeedbackViewController.h"
#import "AboutViewController.h"


@implementation MainMenuViewController
@synthesize msmViewController;
@synthesize numberContentViewController;
@synthesize accountInformationViewController;
@synthesize noticeInformationViewController;
@synthesize feedbackViewController;
@synthesize aboutViewController;

-(IBAction)enterMsmView:(id)sender
{
    MsmViewController *msmController=[[MsmViewController alloc]init];
    self.msmViewController=msmController;
    [self.navigationController pushViewController:msmController animated:YES];
    [msmController release];
    
}

-(IBAction)enterNumberContentView:(id)sender
{
    NumberContentViewController *numberController=[[NumberContentViewController alloc]init];
    self.numberContentViewController=numberController;
    [self.navigationController pushViewController:numberController animated:YES];
    [numberController release];
    
}

-(IBAction)enterAccountInformationView:(id)sender
{
    AccountInformationViewController *accountController=[[AccountInformationViewController alloc] init];
    self.accountInformationViewController=accountController;
    [self.navigationController pushViewController:accountController animated:YES];
    [accountController release];
    
}

-(IBAction)enterNociteInformationView:(id)sender
{
    NoticeInformationViewController *noticeController=[[NoticeInformationViewController alloc]init];
    self.noticeInformationViewController=noticeController;
    [self.navigationController pushViewController:noticeController animated:YES];
    [noticeController release];
    
}

-(IBAction)enterFeedbackViewController:(id)sender
{
    FeedbackViewController *feedbackController=[[FeedbackViewController alloc]init];
    self.feedbackViewController=feedbackController;
    [self.navigationController pushViewController:feedbackController animated:YES];
    [feedbackController release];
}


-(IBAction)enterAboutView:(id)sender
{
    AboutViewController *aboutController=[[AboutViewController alloc]init];
    self.aboutViewController=aboutController;
    [self.navigationController pushViewController:aboutController animated:YES];
    [aboutController release];
    
}




- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [msmViewController release];
    [numberContentViewController release];
    [accountInformationViewController release];
    [noticeInformationViewController release];
    [feedbackViewController release];
    [aboutViewController release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

-(void)logout
{
    //[self.navigationController release];//这里可能存在不妥！～！～！～！～！～ 为什么三次以后就不行了
    //[self.navigationController popToRootViewControllerAnimated:YES];
    sys_ericAppDelegate * app=[[UIApplication sharedApplication] delegate];
	
	[app gotoLoginView];
    

}


- (void)viewDidLoad
{
    self.title=@"欢迎使用本系统";
    UIBarButtonItem *loginButton = [[UIBarButtonItem alloc]
                                    initWithTitle:@"注销"
                                    style:UIBarButtonItemStyleBordered
                                    target:self
                                    action:@selector(logout)];
    self.navigationItem.rightBarButtonItem = loginButton;
    [loginButton release];
    


    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    self.msmViewController=nil;
    self.numberContentViewController=nil;
    self.accountInformationViewController=nil;
    self.noticeInformationViewController=nil;
    self.feedbackViewController=nil;
    self.aboutViewController=nil;
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
